<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta charset="utf-8">
  <title><!--{$lang.page.index.title}--></title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  <link rel="stylesheet" href="/static/lay/layui/css/layui.css" media="all">
  <link rel="stylesheet" href="/static/lay/layui/index.css" media="all">
</head>
<body>

<div class="layui-fluid">
    <div class="layui-card">
      <div class="layui-card-body" style="padding: 15px;">
        <div class="layui-form-item" style="text-align: center;"><b><!--{$lang.page.index.accmanger}--></b></div>
        <form name="addItem" method="post" action="" lay-filter="component-form-group" class="layui-form">
          <input type="hidden" value="<!--{$datainfo.aid}-->" name="aid">

            <div class="layui-form-item">
            <div class="layui-inline">
              <label class="layui-form-label"><!--{$lang.page.index.account}--></label>
              <div class="layui-input-inline">
               <input type="text" name="username" value="<!--{$datainfo.username}-->" lay-verify="username"  class="layui-input readonly" readonly/>
              </div>
            </div>
            <div class="layui-inline">
             <label class="layui-form-label"><!--{$lang.page.public.password}--></label>
              <div class="layui-input-inline">
                <input type="password" name="password" value="" lay-verify="password" placeholder="<!--{$lang.page.public.pinput}-->" autocomplete="off" class="layui-input" />
              </div>
            </div>
            <div class="layui-inline">
              <label class="layui-form-label"><!--{$lang.page.public.userman}--></label>
              <div class="layui-input-inline">
               <input type="text" name="realname" value="<!--{$datainfo.realname}-->" lay-verify="realname" placeholder="<!--{$lang.page.public.pinput}-->" autocomplete="off" class="layui-input" />
              </div>
            </div>  
            </div>

            <div class="layui-form-item">
            <div class="layui-inline">
              <label class="layui-form-label">email</label>
              <div class="layui-input-inline">
               <input type="text" name="email" value="<!--{$datainfo.email}-->"  placeholder="<!--{$lang.page.public.pinput}-->" autocomplete="off" class="layui-input" />
              </div>
            </div>
            <div class="layui-inline">
             <label class="layui-form-label"><!--{$lang.page.table.phone}--></label>
              <div class="layui-input-inline">
                <input type="text" name="mobile" value="<!--{$datainfo.mobile}-->" lay-verify="mobile" placeholder="<!--{$lang.page.public.pinput}-->" autocomplete="off" class="layui-input" />
              </div>
            </div>
            </div>

            <div class="layui-form-item">
              <label class="layui-form-label"><!--{$lang.page.public.header}--></label>
              <div class="layui-inline">
               <div class="layui-upload">
                  <blockquote class="viewpicList"><!--{$lang.page.public.smallimg}-->：
                  <ul><li class="viewpic" id="picdemo1" <!--{if empty($datainfo.header_url)}-->style="display:none;"<!--{/if}-->>
                      <img id="demo1" style="cursor: pointer" src="<!--{$datainfo.header_url}-->" onclick="xadmin.showimg({url:'<!--{$datainfo.header_url}-->',title:'<!--{$datainfo.username}-->',w:500,h:500,par:true})"/></li>
                      <button type="button" class="picup" id="test1">+</button>
                  </ul>
                  </blockquote>
                </div>
                 <span>（<!--{$lang.page.public.suggest}-->1:1<!--{$lang.page.public.dimensions}-->）</span>
                 <input id="imgOne" name="imgOne" type="hidden"/>
              </div>
            </div>
            <!--{if $datainfo.roletype eq 3}-->
            <div class="layui-form-item">
              <div class="layui-inline">
                 <label class="layui-form-label"><!--{$lang.page.public.sharelink}--></label>
                  <div class="layui-input-inline">
                    <input type="text"  style="width: 500px" value="<!--{$datainfo.share}-->" class="layui-input" readonly/>
                  </div>
              </div>
              <div class="layui-inline">
                <button type="button" class="layui-btn " onClick="copyCode('<!--{$datainfo.share}-->');" ><!--{$lang.page.public.copy}--></button>    
              </div>
              <!--{if $datainfo.showewm==true}-->
              <div class="layui-inline">
                <button type="button" class="layui-btn " onclick="xadmin.showimg({url:'<!--{$datainfo.ewmurl}-->',w:580,h:580,par:true})" ><!--{$lang.page.table.view}--></button>    
              </div>
              <!--{/if}-->
              <!--{if $datainfo.showshare==true}-->
              <div class="layui-inline">
                <button type="button" class="layui-btn " onclick="xadmin.showimg({url:'<!--{$datainfo.shareurl}-->',w:360,h:680,par:true})" ><!--{$lang.page.public.share}--></button>    
              </div>
              <!--{/if}-->
            </div>
            <!--{/if}-->
                  
            <div class="layui-form-item layui-layout-admin">
              <div class="layui-footer" >
                <button class="layui-btn" type="button" id="submit"  lay-submit lay-filter="submit"><!--{$lang.page.public.submit}--></button>
                <button type="reset" id="reset" class="layui-btn layui-btn-primary"><!--{$lang.page.public.reset}--></button>
                <button type="button" class="layui-btn layui-btn-primary" onClick="xadmin.close();" ><!--{$lang.page.table.back}--></button>
              </div>
            </div>
        </form>
      </div>
    </div>

    </div>

<script src="/static/lay/layui/layui.js"></script>
  <script type="text/javascript">
    layui.config({
     base: '/static/lay/' //静态资源所在路径
   }).extend({
     xadmin: 'lib/xadmin' //弹窗
   }).use(['jquery', 'layer','xadmin', 'form'], function(){
    var form = layui.form;
     form.render(null, 'component-form-group');
     /* 自定义验证规则 */
    form.verify({

      username: function(value){
        if(value.length < 1){
          return '<!--{$lang.page.index.account}--><!--{$lang.page.public.nocontent}-->';
        }
      },
      mobile:function(value){
        if(value.length < 1){
          return '<!--{$lang.page.table.phone}--><!--{$lang.page.public.nocontent}-->';
        }
      }
    });

    form.on('submit(submit)', function (data) {
        $('#submit').attr("disabled",true);
        $('#submit').addClass('layui-btn-disabled');
        $.post('#',data.field,function(res){
            if(res.code == 200){
                xadmin.close();
                layer.msg(res.msg);
            }else{
                layer.msg(res.msg);
            }
        })
        return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
    });
    //重置按钮，可以提交失败的时候再次提交
    $('#reset').click(function(){
        $('#submit').removeAttr("disabled");
        $('#submit').removeClass('layui-btn-disabled');
    });
  });
  //上传图片
  layui.use('upload', function(){
  var $ = layui.jquery
  ,upload = layui.upload;
   //普通图片上传
  var uploadInst = upload.render({
  elem: '#test1'
  ,url: '/admin/common/upload/?folder=user'
  ,done: function(res){
  //上传成功
      if (res.code == 200) {
            $('#demo1').attr('src', res.data.src); //图片链接（base64）
            $('#imgOne').attr('value', res.data.src); //图片链接（base64)
            $('#picdemo1').show();
          } else {
            layer.msg(res.msg);
          }
      }
    });
  });

  // 点击复制单号
  function copyCode(content) {
    var oInput = document.createElement('input');
    oInput.value = content;
    document.body.appendChild(oInput);
    oInput.select(); // 选择对象
    document.execCommand("Copy"); // 执行浏览器复制命令
    oInput.className = 'oInput';//设置class名
    document.getElementsByClassName("oInput")[0].remove();//移除这个input
    layer.msg('<!--{$lang.page.public.copy}--><!--{$lang.page.public.success}-->', { icon: 0, skin: 'success_msg', time: 3000 });// success_msg; error_msg;warn_msg; 
  }
  </script>
</body>
</html>

